/******************************************************************************/
//	KlinkTimer.cpp	-	Provides simple timing capabilities
//
//	Author:		Russell Klinkerman
//	Created:	09.02.2004
/******************************************************************************/

#include "KlinkTimer.h"

unsigned int CKlinkTimer::uiCurrentTime = timeGetTime();
unsigned int CKlinkTimer::uiPreviousTime = CKlinkTimer::uiCurrentTime;

CKlinkTimer::CKlinkTimer(): uiStartTime(0), uiEndTime(0)
{}

CKlinkTimer::CKlinkTimer(unsigned int _uiEndTime): uiStartTime(0), uiEndTime(0)
{
	Set(_uiEndTime);	// Set the timer
}

CKlinkTimer::~CKlinkTimer()
{
}

void	CKlinkTimer::Update()
{
	uiPreviousTime = uiCurrentTime;	// Set Previous Time
	uiCurrentTime = timeGetTime();	// Get Current Time
}

void	CKlinkTimer::Set(unsigned int _uiEndTime)
{
	uiEndTime	=	uiCurrentTime + _uiEndTime;
}

bool	CKlinkTimer::Check()
{
	// Check if it is time to trigger
	if(uiCurrentTime >= uiEndTime)
		return true;
	
	return false;
}


